# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=woob
pkgver=3.2
pkgrel=2
pkgdesc="Core library and modules for Web outside of Browsers"
arch=(any)
url="https://woob.tech/"
license=(LGPL3)
depends=(
    python-lxml
    python-cssselect
    python-requests
    python-dateutil
    python-yaml
    python-html2text
    python-six
    python-unidecode
    python-pillow
    python-babel
    python-simplejson
)
optdepends=(
    'python-colorama: CLI usage'
    'python-prettytable: CLI output formatting'
    'python-feedparser: required by some modules'
    'python-jose: required by some modules'
    'python-pycryptodome: required by some modules'
    'python-google-api-python-client: multiple Google services like YouTube'
)
makedepends=(python-setuptools)
checkdepends=(python-pytest python-prettytable)
replaces=(weboob)
provides=(weboob)
conflicts=(weboob)
source=(https://files.pythonhosted.org/packages/source/w/${pkgname}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('f3207daa894153af6e21cad8dc99ad4d68915de7316515421d8009cb90ada780')

build() {
  cd ${pkgname}-${pkgver}
  python setup.py build
}

check() {
  cd ${pkgname}-${pkgver}
  pytest -vv --color=yes
}

package() {
  cd ${pkgname}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  rm -r "${pkgdir}"/${site_packages}/tests
}
